<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<script type="text/javascript">
    $(document).ready(function () {
    
	    var uid = $("#user\\.uid").val();
	    var url = "gettransactionbyuser.action?user.uid="+uid;
	    $.getJSON(url, function(data) {
	    	$.each(data, function(i, tran) {
	    		$("#trancTable").append("<tr><td>"+tran.tid+"</td><td>"+"</td><td>"+tran.goods.gname+"</td><td>"
	    		+tran.tstate+"</td><td>"+tran.tprice+"</td></tr>");
       		});
	       });
	        
	       
        $("#submitbutton").click(function () {
            var options = {
                url: 'updateuserinfor.action',
                type: 'post',
                dataType: 'text',
                data: $("#publishform").serialize(),
                success: function (responsedata) {
                    //if (responsedata.length > 0)
                       // $("#responseText").text(responsedata);
                    $('#myModal').modal('show');
                    if(responsedata=="6"){//登录成功
                    	 function jump(count) { 
                			window.setTimeout(function(){ 
                    			count--; 
                    			if(count > 0) { 
                       				$("#printcontent").html("<p class='bg-success'>用户信息修改成功，将在"+count+"秒后进入首页</p>"); 
                        			jump(count); 
                    			} else { 
                        			location.href="p_index.action"; 
                    			} 
                			}, 1000); 
           				 } 
            		jump(3); 
                    }
                    if(responsedata=="4"){
                    	$("#printcontent").html("<p class='bg-danger'>信息修改失败</p>");
                    }
                }
            };
            $.ajax(options);
            return false;
        });
    });	
    
     $(document).ready(function () {
 
  });  
</script>
<div class="container">
	<div class="modal fade" id="myModal"  tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
  				<div class="modal-dialog">
     				<div class="modal-content">
        				<div class="modal-header">
           				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                 					×
           				</button>
           				<h4 class="modal-title" id="myModalLabel">提示</h4>
      					</div>
        				<div class="modal-body" id="printcontent"></div>
        				<div class="modal-footer">
           				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        				</div>
     				</div><!-- /.modal-content -->
			</div><!-- /.modal -->
    </div>
   <input id="user.uid" name="user.uid"  type="text" style="display:none;" value=<s:property value="#session.user.uid"/>>
   <table class="table table-hover" id="transactionList">
      <thead>
        <tr>
          <th>#</th>
          <th>交易时间</th>
          <th>交易商品</th>
          <th>交易状态</th>
          <th>交易金额</th>
        </tr>
      </thead>
      <tbody id="trancTable">
      </tbody>
    </table>
</div>